Skip to content

Fix Modal Fantom test#54811

Closed
alanleedev wants to merge 1 commit into
react:mainfrom
alanleedev:export-D88538595
Closed

Fix Modal Fantom test#54811
alanleedev wants to merge 1 commit into
react:mainfrom
alanleedev:export-D88538595

Conversation

@alanleedev

Copy link
Copy Markdown
Contributor

Summary:
The Modal Fantom test was failing in CI with "MessageQueue is not empty" error. This was caused by Modal's componentDidMount subscribing to ModalEventEmitter, which schedules work in the message queue. When Fantom's afterEach hook runs validateEmptyMessageQueue(), it detects pending work and fails the test.

Added Fantom.runWorkLoop() call at the end of the test to flush any pending messages in the queue before the test completes. This follows the established pattern used throughout the Fantom test suite for handling async operations.

Changelog: [Internal] Fix Fantom test

Differential Revision: D88538595

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 6, 2025
@meta-codesync

meta-codesync Bot commented Dec 6, 2025

Copy link
Copy Markdown

@alanleedev has exported this pull request. If you are a Meta employee, you can view the originating Diff in D88538595.

@alanleedev alanleedev force-pushed the export-D88538595 branch 2 times, most recently from 548788e to 0b2e55e Compare December 9, 2025 16:18
@alanleedev alanleedev changed the title Fix Modal Fantom test by flushing message queue Fix Modal Fantom test Dec 9, 2025
Summary:

Test was failing in CI with following error:
```
Summary of all failing tests
FAIL packages/react-native/Libraries/Modal/__tests__/Modal-itest.js (5.619 s)
  ● <Modal> (hermes) › props › presentationStyle › renders a Modal with presentationStyle="pageSheet"

    Exception in HostFunction: MessageQueue is not empty
        at validateEmptyMessageQueue (native)

      417 |     require('react-native/src/private/testing/fantom/specs/NativeFantom').default;
      418 |
    > 419 |   NativeFantom.validateEmptyMessageQueue();
          |                                         ^
      420 | }
      421 |
      422 | function serializeError(error: Error): FailureDetail {

      at validateEmptyMessageQueue (private/react-native-fantom/runtime/setup.js:419:41)
      at invokeHooks (private/react-native-fantom/runtime/setup.js:286:11)
      at spec (private/react-native-fantom/runtime/setup.js:336:16)
      at suite (private/react-native-fantom/runtime/setup.js:390:20)
      at child (private/react-native-fantom/runtime/setup.js:374:33)
      at suite (private/react-native-fantom/runtime/setup.js:388:22)
      at child (private/react-native-fantom/runtime/setup.js:374:33)
      at suite (private/react-native-fantom/runtime/setup.js:388:22)
      at child (private/react-native-fantom/runtime/setup.js:374:33)
      at suite (private/react-native-fantom/runtime/setup.js:388:22)
      at child (private/react-native-fantom/runtime/setup.js:374:33)
      at suite (private/react-native-fantom/runtime/setup.js:388:22)
      at currentContext (private/react-native-fantom/runtime/setup.js:436:20)
      at anonymous (private/react-native-fantom/runtime/setup.js:470:27)
```

The Modal Fantom test was failing in CI with "MessageQueue is not empty" error. 
Referencing other tests, added afterEach() to call `root.destroy()` for proper cleanup after each test.

Changelog: [Internal] Fix Fantom test

Differential Revision: D88538595
@react-native-bot

Copy link
Copy Markdown
Collaborator

Closing this PR as the diff D88538595 has been abandoned internally.

@alanleedev alanleedev deleted the export-D88538595 branch June 4, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants